drop table if exists compare_table;
CREATE TABLE compare_table (
    id serial PRIMARY KEY,
    source VARCHAR(500),
    schema VARCHAR(500),
    table_name VARCHAR(500),
    table_comment VARCHAR(500),
    column_name VARCHAR(500),
    data_type VARCHAR(500),
    data_length VARCHAR(500),
    data_default VARCHAR(500),
    nullable VARCHAR(500),
    pkey VARCHAR(500),
    column_comment VARCHAR(500),
    creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

drop table if exists tzq_db_cfg_t;
CREATE TABLE tzq_db_cfg_t (
    db_cfg_id serial PRIMARY KEY,
    connect_name VARCHAR(500),
    database_type VARCHAR(500),
    host VARCHAR(500),
    port INT8,
    dbname VARCHAR(500),
    username VARCHAR(500),
    password VARCHAR(500),
    created_by INT8 NOT NULL DEFAULT -1,
    creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    last_updated_by INT8 NOT NULL DEFAULT -1,
    last_update_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    description VARCHAR(500)
);
CREATE UNIQUE index uk_tzq_db_cfg_1 on tzq_db_cfg_t (connect_name);



INSERT INTO compare_table (id, source, schema, table_name, table_comment, column_name, data_type, data_length, data_default, nullable, pkey, column_comment) VALUES (1, 'gauss_tzq_log_dev', 'tzq_log', 'tzq_log_test_a_t', '', 'tzq_log_id', 'INT8', NULL, 'nextval(''tzq_log_test_a_s''::regclass)', 'NO', 'Y', '');
INSERT INTO compare_table (id, source, schema, table_name, table_comment, column_name, data_type, data_length, data_default, nullable, pkey, column_comment) VALUES (2, 'gauss_tzq_log_dev', 'tzq_log', 'tzq_log_test_a_t', '', 'tzq_log_title', 'NVARCHAR2(300)', NULL, '', 'YES', '', '');
INSERT INTO compare_table (id, source, schema, table_name, table_comment, column_name, data_type, data_length, data_default, nullable, pkey, column_comment) VALUES (3, 'gauss_tzq_log_dev', 'tzq_log', 'tzq_log_test_a_t', '', 'tzq_log_type', 'NVARCHAR2(150)', NULL, '''未知''::nvarchar2', 'NO', '', '');
INSERT INTO compare_table (id, source, schema, table_name, table_comment, column_name, data_type, data_length, data_default, nullable, pkey, column_comment) VALUES (4, 'gauss_tzq_log_dev', 'tzq_log', 'tzq_log_test_a_t', '', 'tzq_log_content', 'TEXT', NULL, '', 'YES', '', '');
INSERT INTO compare_table (id, source, schema, table_name, table_comment, column_name, data_type, data_length, data_default, nullable, pkey, column_comment) VALUES (5, 'gauss_tzq_log_dev', 'tzq_log', 'tzq_log_test_a_t', '', 'created_by', 'INT8', NULL, '(-1)', 'NO', '', '');
INSERT INTO compare_table (id, source, schema, table_name, table_comment, column_name, data_type, data_length, data_default, nullable, pkey, column_comment) VALUES (6, 'gauss_tzq_log_dev', 'tzq_log', 'tzq_log_test_a_t', '', 'creation_date', 'TIMESTAMP(0)', NULL, 'pg_systimestamp()', 'NO', '', '');
INSERT INTO compare_table (id, source, schema, table_name, table_comment, column_name, data_type, data_length, data_default, nullable, pkey, column_comment) VALUES (7, 'gauss_tzq_log_dev', 'tzq_log', 'tzq_log_test_a_t', '', 'last_updated_by', 'INT8', NULL, '(-1)', 'NO', '', '');
INSERT INTO compare_table (id, source, schema, table_name, table_comment, column_name, data_type, data_length, data_default, nullable, pkey, column_comment) VALUES (8, 'gauss_tzq_log_dev', 'tzq_log', 'tzq_log_test_a_t', '', 'last_update_date', 'TIMESTAMP(0)', NULL, 'pg_systimestamp()', 'NO', '', '');
INSERT INTO compare_table (id, source, schema, table_name, table_comment, column_name, data_type, data_length, data_default, nullable, pkey, column_comment) VALUES (9, 'gauss_tzq_log_dev', 'tzq_log', 'tzq_log_test_a_t', '', 'sys_description', 'NVARCHAR2(500)', NULL, '''暂无''::nvarchar2', 'NO', '', '');


insert into tzq_db_cfg_t(connect_name, database_type, host, port, dbname, username, password, description)
select 'gauss_plan_sit', 'openGauss', '7.203.228.46', 8000, 'tpc_plan_sit_db', 'fin_tr_plan', 'Tpc@13685', '计划plan的sit环境的高斯数据库';
insert into tzq_db_cfg_t(connect_name, database_type, host, port, dbname, username, password, description)
select 'pg_plan_uat', 'PostgreSQL', '7.203.147.172', 5432, 'cashplan_uat', 'plan', 'Hw13685@', '计划plan的uat环境的PG数据库';







